package com.ocelot.san.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import com.ocelot.san.dto.OperationType;
import com.ocelot.san.repository.OperationTypeRepository;

@Service
public class OperationTypeService {
	
	@Resource
	private OperationTypeRepository operationTypeRepository;
	
	public void save(OperationType operationType) {
		operationTypeRepository.save(operationType);
	}
	
	public OperationType findById(Long id) {
		return operationTypeRepository.findOne(id);
	}

	public void delete(Long id) {
		operationTypeRepository.delete(id);
	}

	
	public List<OperationType> fetchAll() {
		return operationTypeRepository.findAll(new Sort(Sort.Direction.ASC, "description"));
	}

}
